package cn.dubito.miaosha.validator.annotation;

import cn.dubito.miaosha.validator.IsMobileValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * @author liliang
 * @description: 验证手机号注解
 * @date 2018/3/31.
 */
@Documented
@Constraint(validatedBy = {IsMobileValidator.class})
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface IsMobile {

    /**
     * 是否必填
     * @return
     */
    boolean required() default true;

    /**
     * 默认提示信息
     * @return
     */
    String message() default "手机号格式错误";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
